#pragma once

#include "common.hpp"

class client
{
public:
    client() : _fd(gdefaultfd)
    {
        cout << "client init" << endl;
    }
    ~client()
    {
        cout << "client delete" << endl;
    }
    void OpenpipeWrite()
    {
        //_fd=Openpipe(O_WRONLY);
        _fd = ::open(pipefile.c_str(), O_WRONLY);
        if (_fd < 0)
        {
            std::cerr << "fd error" << endl;
        }
    }
    int Sendpipe(const std::string &message)
    {
        return ::write(_fd, message.c_str(), message.size());
    }
    void Closepipe()
    {
        // Closepipehelp(_fd);
        if (_fd > 0)
        {
            ::close(_fd);
        }
    }

private:
    int _fd;
};
